<?php
$feedback_lbl = BUtils::T('feedback_lbl');

$feedback_done_facebook = BUtils::T('feedback_done_facebook_msg', array(
	'{facebook_community}' => '<a href="'.Yii::app()->params['facebookPageUrl'].'">' . BUtils::T('facebook_community_lbl') . '</a>',
));

$this->pageTitle = 'Yamii | ' . $feedback_lbl;
$this->breadcrumbs=array();
?>
<div class="container">
<div class="row-fluid">
	<div style="width:400px; padding:4px 16px;">
		<form id="feedback_form" action="<?php echo Yii::app()->createUrl('/yamii/feedback', array('submit'=>1)) ?>">
			<fieldset>
				<legend><?php echo $feedback_lbl; ?></legend>
<?php if (Yii::app()->user->isGuest) { ?>
				<label><?php echo BUtils::T('email_address_lbl'); ?>:</label>
				<input name="email" type="text" class="span12" placeholder="john@example.com" value="<?php echo Yii::app()->user->getState('email'); ?>" />
<?php } ?>
				<textarea name="content" rows="5" cols="15" class="span12" placeholder="<?php echo BUtils::T('feedback_eg'); ?>"></textarea>
				<br />
				<input type="submit" class="btn btn-info" id="feedback_submit" value="<?php echo BUtils::T('confirm_btn'); ?>" />
				<input type="button" class="btn" id="feedback_cancel" value="<?php echo BUtils::T('cancel_btn'); ?>" />
			</fieldset>
		</form>
		<div id="feedback_done" style="display:none; height:200px;">
			<fieldset>
				<legend><?php echo BUtils::T('feedback_done_lbl') ?></legend>
				<p><?php echo BUtils::T('feedback_done_msg') ?></p>
				<p><?php echo $feedback_done_facebook; ?></p>
			</fieldset>
		</div>
	</div>
</div>
</div>
<script>
$(function() {
	$('#feedback_submit').click(function(){
		$.ajax({
			dataType:'json', type:'post',
			url: '<?php echo Yii::app()->createUrl('/yamii/feedback', array('submit'=>1)) ?>',
			data: $("#feedback_form").serialize(),
			beforeSend: function() {
				$('#feedback_submit').attr('disabled', 'disabled');
			},
			complete: function() {
				$('#feedback_form').hide();
				$('#feedback_done').show();
			}
		});
		return false;
	});
	$('#feedback_cancel').click(function() {
		$(this).colorbox.close();
		return false;
	});
});
</script>